home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Development Platforms / Apple II / Essentials / Technical.Notes / Misc / TN.MISC.017 < prev   
Encoding:
Text File  |  1990-09-21  |  14.9 KB  |  373 lines  |  [TEXT/pdos]

  1. Apple II
  2. Technical Notes
  3. _____________________________________________________________________________
  4.                                                   Developer Technical Support
  5.  
  6. Apple II Miscellaneous
  7. #17:    Buried Treasures of the Video Overlay Card
  8.  
  9. Written by:    Dan Hitchens    September 1990
  10.  
  11. This Technical Note describes some of the more esoteric features of the Video 
  12. Overlay Card.
  13. _____________________________________________________________________________
  14.  
  15.  
  16. What All Does This Thing Do?
  17.  
  18. The Video Overlay Card contains a duplicate of the Apple IIgs video circuitry 
  19. to help accomplish its task.  This makes some pretty unusual (or esoteric, or 
  20. downright weird) display behavior possible.  Although this Note describes 
  21. these techniques, the APDA document "Apple II Video Overlay Card Developers 
  22. Notes" is considered the Bible of the VOC and should be consulted for further 
  23. details, such as how to make the function calls described in this Note and 
  24. what the constant values are.
  25.  
  26.  
  27. RAM Page Select
  28.  
  29. Normally, the Mega II video circuitry on the Apple IIgs looks at bank $E1 (the 
  30. auxiliary bank on Apple IIe) from $2000 to $9FFF for the Super High-Res 
  31. graphics display buffer (pixel data, scan-line control bytes, and color 
  32. palettes).  This is the default for the VOC, and as such, a monitor connected 
  33. to the VOC displays the same Super High-Res graphics as a monitor connected to 
  34. the Apple IIgs main logic board.
  35.  
  36. A feature the VOC card has beyond the Apple IIgs video circuitry is its 
  37. ability to select between bank $E1 (the auxiliary bank on the IIe) and bank 
  38. $E0 (main bank on IIe) for its graphics display buffer.  By specifying bank 
  39. $E0 (or main bank on the IIe) , $E0/2000 to $E0/9FFF becomes the display 
  40. buffer from which the pixel data, scan-line control bytes, and color palettes 
  41. are found.
  42.  
  43. Another added feature of the VOC related to RAM Page Select is its ability to 
  44. interlace between banks $E1 and $E0 (described later in this Note).
  45.  
  46. Note:  When you select bank $E0 as the graphics display bank, you need to 
  47.        ensure that the display buffer memory is linear (remember, the 
  48.        Super High-Res graphics display buffer needs to be linear).
  49.  
  50. Technique
  51.  
  52. PASCAL:
  53.       VDGGControl(VDRAMPageSel,VDAux); {selects Aux bank $E1}
  54.       VDGGControl(VDRAMPageSel,VDMain); {selects Main bank $E0}
  55.       VDGGControl(VDMainPageLin,VDEnable); {enable main page $E0 linearization}
  56.       VDGGControl(VDMainPageLin,VDDisable); {disable main page linearization}
  57.  
  58. Uses
  59.  
  60.   o  Dual monitors.  A monitor connected to the main logic board of the 
  61.      IIgs has its display buffer in the normal $E1 bank, while a 
  62.      monitor connected to the VOC has its display buffer in bank $E0.
  63.  
  64.   o  Double-buffered graphics.  This is the ability to draw graphics in 
  65.      one bank while displaying from the other, then switching display 
  66.      banks when appropriate.
  67.  
  68.  
  69. Interlacing
  70.  
  71. As mentioned earlier, another added feature of the VOC is its ability to 
  72. perform 400 line interlacing.  By enabling interlacing on the VOC, the card 
  73. displays the even and odd lines from different memory areas depending on the 
  74. setting of the RAM page select.  If interlacing is enabled and the auxiliary 
  75. bank is selected (the default at reset), then the VOC displays both the even 
  76. and odd scan lines from bank $E1, giving the same display as if interlacing 
  77. was not enabled at all (the 200 lines from bank $E1 are interlaced with the 
  78. same 200 lines from bank $E1).  If interlacing is enabled and the main bank is 
  79. selected, then the VOC displays both the even and odd scan lines from bank $E0 
  80. (same sort of thing, the 200 lines from bank $E0 are interlaced with the same 
  81. 200 lines from bank $E0.)
  82.  
  83. Now for the useful part,--if interlacing is enabled and RAM Page Select is set 
  84. to interlace, then interlacing occurs between banks $E1 and $E0 (the odd 200 
  85. lines come from bank $E1 and the even 200 lines come from bank $E0).
  86.  
  87. Remember in Super High-Res interlace mode, not only the pixel data but also 
  88. the scan line control bytes and color palettes can be different between the 
  89. two banks and need to be loaded.  Also be sure to turn main page linearization 
  90. on before loading data into the $E0 bank (see discussion on RAM Page Select).
  91.  
  92. Technique
  93.  
  94. PASCAL:
  95.     VDGGControl(VDRAMPageSel,VDInterlace); {selects interlacing between banks
  96.                                               $E1 and $E0}
  97.     VDGGControl(VDInterlaceMode,VDEnable); {enables 400 line interlace mode}
  98.     VDGGControl(VDInterlaceMOde,VDDisable); {disables 400 lines interlace mode}
  99.  
  100. Uses
  101.  
  102.   o  400-line display.  A monitor connected to the VOC can display 400 
  103.      different lines when interlace is enabled and RAM Page Select is 
  104.      set to interlace.
  105.  
  106.      Warning:  The technique of interlacing can cause 
  107.                noticeable flicker when pixels on adjacent 
  108.                horizontal lines are different.
  109.  
  110.  
  111. Dual Monitors
  112.  
  113. Because the VOC has a duplicate of the video circuitry of the Apple IIgs, it 
  114. has the capability to have two monitors displaying the same or totally 
  115. different information at the same time.  The VOC doesn't have to be in the 
  116. same display mode as the main logic board.  It can be in the same video mode 
  117. or in a totally different one (i.e., the main logic board is in text mode 
  118. while the VOC is in Super High-Res mode.)
  119.  
  120. The technique required for putting the VOC into a video mode different from 
  121. that of the main logic board's circuitry is to enable and disable, at the 
  122. appropriate time, the bus to the VOC.  To go into the video mode in which you 
  123. want the VOC to remain, you must first make sure the bus is enabled (power on 
  124. default).  Once you have the VOC in the mode you want, disable the bus with 
  125. VDGGControl(VDGGBus, VDEnable), then go into the video mode in which you want 
  126. the main logic board.  After you have the main logic board into the mode you 
  127. want, reenable the bus with VDGGControl(VDGGBus, VDDisable).  Remember to 
  128. reenable the bus or the VOC screen remains frozen--memory writes to the video 
  129. display buffers are not written through to the VOC's internal memory display 
  130. buffers.
  131.  
  132. Technique
  133.  
  134. PASCAL:
  135.    VDGGControl(VDGGBus,VDEnable);  {Enables the GGBus_Disable circuitry which
  136.                                     inhibits writes to the VOC display memory.}
  137.    VDGGControl(VDGGBus,VDDisable); {Disables the GGBus_Disable circuitry which
  138.                                     enables writes to the VOC display memory
  139.                                     (power on default)}
  140.  
  141. Uses
  142.  
  143.   o  Two monitors with different display modes.  A monitor connected to 
  144.      the VOC can display one mode while a monitor connected to the main 
  145.      logic board is displaying another.  There are many different 
  146.      applications that could benefit from this type of monitor 
  147.      arrangement.  For example, you might need one monitor to display 
  148.      control information, while another is displaying graphics (a 
  149.      debugger could trace code in text mode on one monitor, while the 
  150.      other monitor is displaying the actual graphics in real time.)
  151.  
  152.  
  153. Apple IIe
  154.  
  155. One of the outstanding features of the VOC is its ability to provide all the 
  156. video modes found on the IIgs to the Apple IIe community, including Super 
  157. High-Res graphics (320x200 or 640x200 bit resolution).  Not only can Apple IIe 
  158. owners experience the world of Super High-Res graphics with the VOC, they also 
  159. can perform all the previously mentioned functions (such as RAM page select, 
  160. interlacing, and dual monitors).
  161.  
  162. Super High-Res graphics mode on the IIe is enabled the same way as on the 
  163. IIgs.  The New Video register, which is located at $C029, is the register 
  164. which controls the mode.  The following is a short description of the bits for 
  165. this register as found in the Apple IIgs Hardware Reference:
  166.  
  167.     Bit 7:    0    Enables old Apple IIe video modes
  168.               1    Enables Super High-Res video mode
  169.     Bit 6:    0    Memory linearization is disabled (old Apple IIe memory 
  170.                    map configuration)
  171.               1    Memory linearization is enabled (memory from $2000 to 
  172.                    $9D00 becomes one linear address space.)
  173.     Bit 5:    0    Double Hi-Res graphics are displayed in color
  174.               1    Double Hi-Res graphics are displayed in black and white
  175.     Bits 4-0:      Undefined
  176.  
  177. From this description, all that is needed to switch into Super High-Res 
  178. display mode, is to set bits six and seven at memory location $C029.  When you 
  179. want to go back to the old Apple IIe video modes, just clear bits six and 
  180. seven.
  181.  
  182. Note:  The Super High-Res graphics display buffer on the Apple IIe is 
  183.        located in Auxiliary memory from $2000 to $9FFF (unless its been 
  184.        changed to Main page with RAM page select, as described earlier in 
  185.        this Note).  Within this display buffer, you must set up the 
  186.        following three types of data:
  187.  
  188.        $2000-$9CFF    Pixel Data 
  189.        $9D00-$9DFF    Scan-line control bytes
  190.        $9E00-$9FFF    Color palettes
  191.  
  192.        For more details, see the Apple IIgs Hardware Reference.
  193.  
  194. Implementation Technique
  195.  
  196. The thing to remember is to make sure memory linearization is on ($C029 bit 
  197. 6=1) before you fill the Super High-Res buffer ($2000-$9FFF).  If you write a 
  198. program that moves data into the display buffer with memory linearization off 
  199. ($C029 bit 6=0), then enable Super High-Res by turning bits six and seven on, 
  200. you do not get the results you anticipate.  What you see is a scrambled mess 
  201. on the screen, because you filled the display buffer with memory linearization 
  202. off (the VOC filled its display buffer in a nonlinear manner), and when you 
  203. turned Super High-Res mode on, the VOC expected to see memory in a linear 
  204. manner.
  205.  
  206. Apple IIe Super High-Res Demo Program
  207.  
  208. ****************************************************************
  209. *
  210. *   A simple Apple IIe super high res. screen demo load program for
  211. *   use with the "Apple II Video Overlay Card"
  212. *
  213. *    Copyright Apple Computer, Inc. 1989
  214. *    All rights reserved.
  215. *
  216. *    Programmed by: Dan Hitchens May 1989  
  217. *
  218. ****************************************************************
  219. *
  220. *    This program loads super high res. screen dumped files which
  221. *   were named "SCREEN.x" (where x starts at zero and increments
  222. *   up sequentially.)  When this program doesn't find the next
  223. *   sequential file, it beeps and starts looking back at
  224. *   "SCREEN.0" again (this program loops endlessly.)
  225. *
  226.         longi off
  227.         longa off
  228.         MACHINE M65c02
  229.         ENTRY begin:CODE
  230.  
  231. ***************************************************************
  232.  
  233. begin        PROC
  234. BEll1        EQU $FBDD              ;beep subroutine
  235. MLI          EQU $BF00              ;ProDos-8 machine language interface
  236. AuxMove      EQU $C311              ;Aux. move firmware routine
  237. OpenCMD      EQU $C8                ;Open command
  238. ReadCMD      EQU $CA                ;Read command
  239. CloseCMD     EQU $CC                ;Close command
  240.  
  241.              lda #$40
  242.              sta $C029              ;turn on memory linearization
  243.  
  244. NextFile     nop
  245. ;First init. a few counters
  246.  
  247.              lda #$20
  248.              sta AuxAddr            ;init aux. address counter
  249.  
  250. ;Now Open the file
  251.              jsr MLI                ;perform an open command
  252.              dc.b OpenCmd           ;passed command (open)
  253.              dc.w OpenBlk           ;passed block address
  254.              beq OKOpen2            ;branch if able to open file
  255.  
  256. ;We arrive here if unable to open the file (probably wasn't there)
  257. InitZero     jsr Bell1              ;sound the bell
  258.              lda #'0'               ;re-init to "SCREEN.0"
  259.              sta FileNum-1          ;init. SCREEN.x to .0
  260.              jmp NextFile           ;go try opening "SCREEN.0"
  261.  
  262. OKOpen2      lda ORefNum            ;get ref. num from open command
  263.              sta RRefNum            ;store for read command
  264.              sta CRefNum            ;store for close command
  265.  
  266. OKOpen       nop
  267. ;Now read $4000 bytes into $3000
  268.              jsr MLI                ;call machine language interface
  269.              dc.b ReadCMD           ;passed command (read)
  270.              dc.w ReadBlk           ;passed block address
  271.              sta MyError            ;save returned error (if any)
  272.              bcs AllDone            ;branch if error occurred
  273.  
  274. ;Set starting address to $3000
  275.              lda #0
  276.              sta $3c
  277.              lda #$30
  278.              sta $3d
  279. ;Set ending address to $6fff
  280.              lda #$ff
  281.              sta $3e
  282.              lda #$6f
  283.              sta $3f
  284. ;Set destination starting addr to AuxAddr (its incremented)
  285.              lda #0
  286.              sta $42
  287.              lda AuxAddr
  288.              sta $43
  289.  
  290.              sec                    ;to indicate move from main to aux mem.
  291.              jsr AuxMove            ;now move the data to aux. memory
  292.  
  293. ;Now increment AuxAddr:=AuxAddr+$4000
  294.              lda AuxAddr
  295.              clc
  296.              adc #$40
  297.              sta AuxAddr
  298.              lda MyError            ;get error (if any)
  299.              beq OKOpen             ;continue reading until error (eof)
  300.  
  301. ;Now we can turn on the super high res screen
  302. AllDone      nop
  303.              lda #$c0
  304.              sta $c029
  305.  
  306.  
  307. ;Now delay for awhile (just a big delay loop)
  308.              lda #0
  309.              tax
  310.              tay
  311.              lda #12
  312. xloop        dex
  313.              nop
  314.              nop
  315.              nop
  316.              nop
  317.              nop
  318.              nop
  319.              nop
  320.              nop
  321.              nop
  322.  
  323.              bne xloop
  324. yloop        dey
  325.              bne xloop
  326.              dec a
  327.              bne xloop
  328.  
  329. ;Now Close the file
  330.              jsr MLI                ;do a Close command
  331.              dc.b CloseCmd          ;passed command (close)
  332.              dc.w CloseBlk          ;passed block address
  333.  
  334. ;Now increment to next file
  335.              lda FileNum-1          ;get current file number
  336.              cmp #'9'               ;is it nine
  337.              beq InitZero           ;branch if already at nine
  338.              clc
  339.              adc #1                 ;else add one to next "SCREEN.x"
  340.              sta FileNum-1
  341.              jmp NextFile           ;go try and read next file
  342.  
  343. ;-------------------------------------------------------------------
  344.         STRING PASCAL               ;we want pascal strings
  345. OpenBlk      dc.b 3
  346.              dc.W Pathname
  347.              dc.W $2700
  348. ORefNum      ds.b 1                 ;returned ref_num
  349. Pathname     dc.b 'SCREEN.0'
  350. FileNum      ds.b 1
  351. ReadBlk      dc.b 4                 ;no. of parameters
  352. RRefNum      ds.b 1                 ;ref. number (stuffed from Open command)
  353.              dc.w $3000             ;data buffer pointer
  354.              dc.w $4000             ;request count
  355.              ds.w 1                 ;actual data transferred count
  356.  
  357. CloseBlk     dc.b 1                 ;no. of parameters
  358. CRefNum      ds.b 1                 ;ref. number (Stuffed from Open command)
  359.  
  360. AuxAddr      ds.b 1                 ;aux. address pointer
  361.  
  362. MyError      ds.b 1
  363. ;-------------------------------------------------------------------
  364.             ENDP
  365.         END
  366.  
  367.  
  368. Further Reference
  369. _____________________________________________________________________________
  370.   o  Apple IIgs Hardware Reference
  371.   o  Apple II Video Overlay Card Developers Notes (APDA)
  372.  
  373.